package abstractfactory;

import abstractfactory.factory.AbstractFactory;
import abstractfactory.factory.ChicagoFactory;
import abstractfactory.factory.NewyorkFactory;
import abstractfactory.product.cheese.Cheese;
import abstractfactory.product.clams.Clams;
import abstractfactory.product.dough.Dough;
import abstractfactory.product.sauce.Sauce;

/**
 * description:
 *  抽象工厂提供了一组创建相关产品的方法
 *  子类实现这组方法，各自决定生产何种产品
 * @author yuanmenglv on 2019/11/28
 */
public class Client {
    public static void main(String[] args) {
        System.out.println("-----------the products come from Chicago-------------------------");
        AbstractFactory chicagoFactory = new ChicagoFactory();
        Cheese cheese = chicagoFactory.createCheese();
        Clams clams = chicagoFactory.createClams();
        Dough dough = chicagoFactory.createDough();
        Sauce sauce = chicagoFactory.createSauce();
        System.out.println(cheese);
        System.out.println(clams);
        System.out.println(dough);
        System.out.println(sauce);

        System.out.println("--------------------the products come from NewYork----------------");
        AbstractFactory newYorkFactory = new NewyorkFactory();
        Sauce sauce1 = newYorkFactory.createSauce();
        Dough dough1 = newYorkFactory.createDough();
        Clams clams1 = newYorkFactory.createClams();
        Cheese cheese1 = newYorkFactory.createCheese();
        System.out.println(sauce1);
        System.out.println(dough1);
        System.out.println(clams1);
        System.out.println(cheese1);
    }
}
